class User < ActiveRecord::Base

  validates_presence_of     :user_name
  validates_uniqueness_of   :user_name
  validates_length_of       :user_name, :in => 4..20, :message => "Username must be between 4-20 characters"
  validates_format_of       :user_name, :with => /\A[a-zA-Z0-9]+\Z/i,
                            :message => " must contain only letters and numbers."


  validates_presence_of     :password
  validates_confirmation_of :password, :message => "Passwords do not match", :on => :create
  
  validates_presence_of     :email
  validates_uniqueness_of   :email
  validates_format_of       :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :message => " must be of this@domain.com format"

  validates_presence_of     :birthday


end
